<?php
require_once '../Config.php';
$con = mysql_connect ( host, username, password );
if (! $con) {
	die ( 'Could not connect: ' . mysql_error () );
}
mysql_select_db ( db, $con );
$arr = array();
$sql = "set names utf8";
mysql_query($sql);
$sql = "select * from j_tab_xuexi";
$result = mysql_query($sql);
if(empty($result)){
	$json = json_encode($arr);
	echo $json;
}else{
	$i=0;
	while($row=mysql_fetch_array($result)){
		$id = $row['id'];
		$title = $row['title'];
		$content = $row['content'];
		$arr[$i]['id'] = $id;
		$arr[$i]['title'] = $title;
		$arr[$i]['content'] = $content;
		$i ++;
	}
	$json = json_encode($arr);
	echo $json;
}
?>